<?php
// +----------------------------------------------------------------------
// | snake
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\model\NodeModel;
use app\admin\model\AppModel;
class Index extends Base
{
    public function index()
    {
        // 获取权限菜单
        $node = new NodeModel();
        $this->assign([
            'menu' => $node->getMenu(session('rule'))
        ]);
        return $this->fetch('/index');
    }

    /**
     * 后台默认首页
     * @return mixed
     */
    public function indexPage()
    {
        $app = new AppModel();
        $map["DATE_FORMAT(app_time,'%Y-%m-%d')"] = date('Y-m-d');
        $count = $app->getAppCount($map);
        $maps["DATE_FORMAT(app_time,'%Y-%m-%d')"] = date('Y-m-d');
        $maps['app_status'] = 1;
        $success_count = $app->getAppCount($maps);
        $mapss["DATE_FORMAT(app_time,'%Y-%m-%d')"] = date('Y-m-d');
        $mapss['app_status'] = 2;
        $error_count = $app->getAppCount($mapss);
        $this->assign('count',$count);
        $this->assign('success_count',$success_count);
        $this->assign('error_count',$error_count);
        return $this->fetch('index');
    }
}
